


<div>
    <div style="float: left;width: 40%">

        <form>
            <select name="language" style="width:100px;margin-top: 45px;" onchange="submit(this);">
                <option value="">语言</option>
                <% plateDatas.forEach(function(plateData,index){%>
                <% if(language==plateData._id){%>
                <option value="<%- plateData._id%>" selected="selected"><%- plateData.platename%></option>
                <%}else{%>
                <option value="<%- plateData._id%>"><%- plateData.platename%></option>
                <%}%>
                <% })%>
            </select>
        </form>

    </div>
    <div style="float: left;width: 40%;margin-top: 45px;">
        <form id="search">
            <div class="input-append" style="width: 85%">
                <input type="text" placeholder="搜索话题"  name="search" style="width: 100%" onfocus="showborder(this);" onblur="hiddenborder(this)"><img src="/images/search.png" style="width: 30px;height: 30px;" onclick="searchsubmit();">
            </div>
        </form>
    </div>
    <div style="clear: both"></div>

    <% if(datas.length==0){%>
    <div style="height:200px;background-color: white;border: 1px solid #ffffff;-moz-border-radius: 10px;-webkit-border-radius: 10px;margin-top: 20px;padding: 20px;text-align: center">
        <div style="color: #000000;margin-top: 20px;font-size: large;line-height: 150px">当前没有数据!!!</div>
    </div>
    <%}else{%>
    <div style="background-color: white;border: 1px solid #ffffff;-moz-border-radius: 10px;-webkit-border-radius: 10px;margin-top: 20px">
        <% datas.forEach(function(data,index){ %>
        <div style="padding: 20px;padding-bottom: 0px">
            <div style="width: 12%;float: left">
                <img class="img-rounded" src="<%-data.publishUser.headSrc%>" style="width: 50px;height: 50px;">
            </div>
            <div style="width: 75%;float: left">
                <span style=""><h4 style="margin: 0px"><b><a href="/postParticulars?id=<%- data._id %>" target="_blank"><%- data.theme %></a></b></h4></span><br>
                <span style="color:#c3c3c3 ">发布人：<a href="/partnerCenter?username=<%- data.publishUser.username %>"><%- data.publishUser.nickname%></a></span>
            </div>
            <div style="clear: both"></div>
            <hr style="margin-bottom: 0px">
        </div>
        <% }) %>
    </div>
    <%}%>
</div>

<div class="span8">
    <div id="page2"></div>
</div>


<script>

    function searchsubmit(){
        $("#search").submit();
    }
    function showborder(obj){
        obj.style.cssText="border:1px #D79114 solid;width: 100%";
    }
    function hiddenborder(obj){
        obj.style.cssText="width: 100%";
    }
    function submit(obj){
        obj.submit();
    }
    $(function(){

        //提交表单
        $('#search').ajaxForm({
            success: showResponse //成功返回
        });
        //获得浏览器参数
        $.extend({
            getUrlVars: function(){
                var vars = [];
                var hash;
                var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
                console.log(hashes);
                for(var i = 0; i < hashes.length; i++){
                    hash = hashes[i].split('=');
                    vars.push(hash[0]);
                    vars[hash[0]] = hash[1];
                }
                return vars;
            },
            getUrlVar: function(name){
                return $.getUrlVars()[name];
            }
        });

        //封装浏览器参数
        var composeUrlParams=function(){
            var param='';
            $.each($.getUrlVars(), function(i, item) {
                if(item!='num'){
                    var val=$.getUrlVar(item);
                    if(val) param += "&" + item+"="+val;
                }
            });
            return param;
        }
        var options = {
            currentPage:<%- page.num %>,                //当前页，css样式同其他页不同
            totalPages:<%- page.pageCount %>,           //总页数
            numberOfPages:5,                            //导航最多显示页数
            pageUrl: function(type, page, current) {    //页面跳转
                if(page!=<%- page.num %>){
                    return "/manager/toPost?num="+ page+composeUrlParams();
                }

            }
        }
        $('#page2').bootstrapPaginator(options);
    })
    function showResponse(result, statusText, xhr, $form){
        if(result!='1'){
            //$.fancybox.close();
            $('#coffeeData').html(result);
        }else{
            alert('数据加载失败，请稍后再试');
        }
    }
</script>